<template>
  <div class="music-list">
    <ul class="body-group">
      <li class="body-item" v-for="(item,index) in data" :key="index"
        @click="itemClick(item,index)">
        <!-- <router-link :to="{name: 'songlist', params:{id:item.id}}"> -->
        <img class="item-img" v-lazy="item.picUrl" >
        <span class="item-span">{{ item.name }}</span>
        <!-- </router-link> -->
      </li>
    </ul>
  </div>
</template>

<script>

  export default {
    props: {
      data: Array,
      title: String,
      titleFlag:{
        type:Boolean,
        default:true
      }
    },

    methods:{
      itemClick(item,index){
        console.log(item.id);
        this.$router.push({path:'/singer/' + item.id});
      }
    }
  }
</script>

<style scoped>
.music-list {
  width: 100%;
  margin: auto;
  padding-top: 10px;
}

.title {
  height: 40px;
  line-height: 40px;
  margin-left: 3vw;
}

.body-group {
  width: 100%;
  padding: 0 10px;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.body-item {
  width: 30%;
  display: inline-block;
  margin-bottom: 15px;
  height: auto;
  flex: 0 0 30%;
  font-size: 14px;
}

.item-span {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.item-img,
.item-span {
  width: 100%;
  border-radius: 5px;
  color: rgb(80, 80, 80);
}

a {
  text-decoration: none;
  color: black;
}
</style>